import { api, request } from './request'

//? 获取所有商品
export const getAllProducts = () => request(api.get, '/api/admin/products')

//? 添加商品
export const createProduct = (product) => request(api.post, '/api/admin/products', product)

//? 根据ID查询单个商品
export const getProductById = (productId) => request(api.get, `/api/admin/products/${productId}`)

//? 更新商品信息
export const updateProductById = (product) => request(api.put, `/api/admin/products/${product.id}`, product)

//? 删除商品
export const deleteProductById = (productId) => request(api.delete, `/api/admin/products/${productId}`)